﻿<!--#include file="conn.asp"--><!--#include file="inc/CHAR.INC"-->
<%if request("act")="del" then
conn.execute("delete from link where id in("&request("id")&")")
conn.close
set conn=nothing
response.redirect Request.ServerVariables("HTTP_REFERER")
response.end
end if%>

<%if request("act")="join" then
sitename=request.form("sitename")
siteurl=request.form("siteurl")
siteinfo=request.form("siteinfo")
if sitename ="" then
response.write("<script>alert('错误：标题不能为空!');history.go(-1)</script>")
response.end
end if

if siteurl ="" then
response.write("<script>alert('错误：URL不能为空!');history.go(-1)</script>")
response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select * from link"
rs.open sql,conn,1,3
rs.AddNew
rs("sitename")=sitename
rs("siteurl")=siteurl
rs("siteinfo")=siteinfo
rs.Update
rs.Close
response.write("<script>alert('成功：添加友情连接成功!');location='link_manage.asp'</script>")
response.end
%>
<%end if%>
<%if request("act")="mdok" then
id=request.form("id")
sitename=request.form("sitename")
siteurl=request.form("siteurl")
siteinfo=request.form("siteinfo")
if sitename ="" then
response.write("<script>alert('错误：标题不能为空!');history.go(-1)</script>")
response.end
end if
if siteurl ="" then
response.write("<script>alert('错误：URL不能为空!');history.go(-1)</script>")
response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select * from link where id="&id
rs.open sql,conn,1,3
rs("sitename")=sitename
rs("siteurl")=siteurl
rs("siteinfo")=siteinfo
rs.Update
rs.Close
set rs=nothing 
response.write("<script>alert('成功：修改友情连接成功!');location='link_manage.asp'</script>")
response.end
end if%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>网站分类管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content=vv23com name=Author><LINK href="images/style.css" 
type=text/css rel=stylesheet>
<META content="MSHTML 6.00.3790.0" name=GENERATOR>
<style type="text/css">
<!--
.STYLE1 {
	color: #000000;
	font-weight: bold;
}
-->
</style>
</HEAD>
<BODY style="FONT-SIZE: 12px; v-text-align: center" leftMargin=0 topMargin=0 
align="center" marginheight="0" marginwidth="0">
<%if request("act")="modify" then
set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from link where id = "&request("id")&""
rs.Open sql,conn,1,1
if rs.EOF then
response.write("<script>alert('错误：ID不存在或是已经删除!');history.go(-1)</script>")
response.end
else
id=rs("id")
sitename=rs("sitename")
siteurl=rs("siteurl")
siteinfo=rs("siteinfo")
end if 
%><form name="form1" method="post" action="?act=mdok">
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" style='margin-bottom:5px'>
    <tr bgcolor="3972B4"> 
      <td colspan="3" bgcolor="e1e1e1"> <div align="center" class="STYLE1">修改友情连接</div></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="16%"> <div align="right">友情连接名称：</div></td>
      <td width="48%"> <input name="sitename" type="text" id="sitename" value="<%=sitename%>" size="30">
        <input name="id" type="hidden" value="<%=id%>"> </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td> <div align="right">网站ALT说明：</div></td>
      <td><input type="text" name="siteinfo" value="<%=siteinfo%>"  size="30">
   </td>
    </tr>
   
    <tr bgcolor="#FFFFFF"> 
      <td> <div align="right">友情连接网址：</div></td>
      <td colspan="2"> <input name="siteurl" type="text" id="siteurl" value="<%=siteurl%>" size="60"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td colspan="3"> <div align="center">&nbsp; 
          <input name="goback3" type="button" class="Submit" id="goback33"  onClick="history.back();" value="返回">
          &nbsp; 
          <input type="submit" name="Submit2" class="Submit" value="修改资料" onClick="{if(confirm('确定资料？')){return true;}return false;}">
        </div></td>
    </tr>
  </table>
</form><%end if%>
<%if request("act")="add" then
%><form name="form1" method="post" action="?act=join">
<table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" style='margin-bottom:5px'>
    <tr bgcolor="3972B4"> 
      <td colspan="3" bgcolor="e1e1e1"> <div align="center" class="STYLE1">增加友情连接</div></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="16%"> <div align="right">友情连接名称：</div></td>
      <td width="48%"> <input name="sitename" type="text" id="sitename" size="30">      </td>
    </tr>    <tr bgcolor="#FFFFFF"> 
      <td width="16%"> <div align="right">网站ALT说明：</div></td>
      <td width="48%"> <input name="siteinfo" type="text" id="siteinfo" size="30">      </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td> <div align="right">友情连接网址：</div></td>
      <td colspan="2"> <input name="siteurl" type="text" id="siteurl" value="" size="60"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td colspan="3"> <div align="center"> 
          <input type="submit" name="Submit" class="Submit" value="增加友情连接">
        </div></td>
    </tr>
  </table>
</form><%end if%>
<div align="center"> </div>
</BODY></HTML>
